reboot system
case:factory reset
Settings/src/com/android/settings/MasterClear.java
sendBroadcast(new Intent("android.intent.action.MASTER_CLEAR"));
->
frameworks/base/services/java/com/android/server/MasterClearReceiver.java
RecoverySystem.rebootWipeUserData(context);
->
frameworks/base/core/java/android/os/RecoverySystem.java
bootCommand(context, "--wipe_data");
->
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
pm.reboot("recovery");
->
frameworks/base/services/java/com/android/server/PowerManagerService.java
public void reboot(String reason){
ShutdownThread.reboot(mContext, finalReason, false);
}
->
frameworks/base/core/java/com/android/internal/app/ShutdownThread.java
rebootOrShutdown(){
Power.reboot(reason);
}
->
frameworks/base/core/java/android/os/Power.java
rebootNative(reason);
->
frameworks/base/core/jni/anroid_os_Power.cpp
__reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, (char*) chars);
->
kernel/kernel/sys.c
case LINUX_REBOOT_CMD_RESTART2:
kernel_restart(buffer);
->
machine_restart(cmd);
->
kernel/arch/arm/kernel/process.c
void arm_machine_restart(char mode, const char *cmd){
//set flag and reboot
}